import axios from 'axios'
import http from '@/utils/httpd';

const apiUrl = 'api/moment';
// 修改为不包含/api的路径
const BASE_URL = 'http://127.0.0.1:8000/api'

// 获取全部朋友圈动态
export function getMomentList() {
  return axios.get(`${BASE_URL}/moment/list`);
}

// 获取用户朋友圈动态
export function getUserMoments(userId) {
  return axios.get(`${BASE_URL}/moment/user/${userId}`);
}

// 获取动态详情
export function getMomentDetail(id) {
  return axios.get(`${BASE_URL}/moment/detail/${id}`);
}

// 发布动态
export function publishMoment(data) {
  return axios.post(`${BASE_URL}/moment/publish`, data);
}

// 更新动态
export function updateMoment(data) {
  return axios.put(`${BASE_URL}/moment/update`, data);
}

// 删除动态
export function deleteMoment(id) {
  return axios.delete(`${BASE_URL}/moment/delete/${id}`);
}

// 点赞
export function likeMoment(data) {
  return axios.post(`${BASE_URL}/moment/like`, data);
}

// 取消点赞
export function unlikeMoment(data) {
  return axios.post(`${BASE_URL}/moment/unlike`, data);
}

// 发表评论
export function commentMoment(data) {
  return axios.post(`${BASE_URL}/moment/comment`, data);
}

// 删除评论
export function deleteComment(id, momentId) {
  return axios.delete(`${BASE_URL}/moment/comment/delete/${id}?momentId=${momentId}`);
} 